<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <script src="../static/js/vue.js"></script>

  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .card-header {
      display: flex;
      justify-content: space-between;
      align-items: center;
    }

    .example-showcase {
      padding: 1rem;
      margin: .5px;
    }
  </style>
  <!-- import CSS -->
  <link rel="stylesheet" href="../static/style/element-plus.css">
  <style>
    .el-table .warning-row {
      --el-table-tr-background-color: var(--el-color-warning-lighter);
    }

    .el-table .success-row {
      --el-table-tr-background-color: var(--el-color-success-lighter);
    }
  </style>
  <!-- import JavaScript -->
  <script src="../static/js/element-plus.js"></script>
  <script src="../static/js/ace/ace.js" type="text/javascript" charset="utf-8"></script>
  <script src="../static/js/ace/ext-language_tools.js" type="text/javascript"></script>
  <script>
    const { ipcRenderer } = require("electron");
    const { ref, reactive, onUnmounted } = Vue;
    const { ElMessageBox } = ElementPlus;
  </script>
</head>

<body>
  <div id="app">
    <user-defined-list v-if="page == 'list'" @turnToPage="navigator"></user-defined-list>
    <user-defined-form v-if="page == 'form'" :initdata="shelldata" @turnto="navigator"></user-defined-form>
  </div>
</body>
<script src="../static/components/AceEditor.component.js"></script>
<script src="../static/components/UserDefinedForm.component.js"></script>
<script src="../static/components/UserDefinedList.component.js"></script>
<script>
  const App = {
    components: {
      UserDefinedForm,
      UserDefinedList
    },
    data() {
      return {
        page: 'list',
        shelldata: {}
      }
    },
    methods: {
      navigator(res) {
        if (typeof res == "string") {
          this.page = res;
          this.shelldata = {};
        } else {
          this.page = res.name;
          this.shelldata = res.data;
        }
      }
    },
  };
  app = Vue.createApp(App);
  app.use(ElementPlus);
  app.mount('#app');
</script>

</html>